<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="org.huqiwen.blog.data.LinkDataBean"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>编辑友情链接</title>
  <link rel="stylesheet" type="text/css" href="/MyBlogDemo/skin/default/css/index.css">
  <link rel="stylesheet" type="text/css" href="/MyBlogDemo/skin/default/css/link.css">
  <script type="text/javascript" src="../js/verify.js"></script>
  <jsp:useBean id="link" class="org.huqiwen.blog.logic.LinkLogicBean"/>
  <%List<LinkDataBean> linkList = link.findAll();%>
  </head>  
  <body>
  <div id="container">
  	<jsp:include page="../head.jsp"/>
  	<div id="addEditor">
  		<h5>添加新的友情链接</h5>
	  	<form action="../LinkActionServlet?method=addLink" method="post" name="form1">
	  	<table>
	  	<tr>
	  		<td>链接名称：</td><td><input type="text" name="name" id="name">(必填)</td>
	  	</tr>
	  	<tr>
	  		<td>链接地址：</td><td><input type="text" name="url" id="url" value="http://">(必填)</td>
	  	</tr>
	  	<tr>
	  		<td>描述：</td><td><input type="text" name="desceription" id="des">(必填)</td>
	  	</tr>
	  	<tr>
	  		<td></td><td><input type="button" value="添加链接" class="sub" onclick="addLink()" /></td>
	  	</tr>
	  	</table>
	  	</form>
	  <hr>
	 </div>

	 <div id="adminEditor">
	 <h5>管理已有友情链接</h5>
	 	<form method="post">
		 	<table cellpadding="0" cellspacing="0">
		 		<tr class="head">
		 			<td class="linkName">链接名称</td>
		 			<td class="linkUrl">链接地址</td>
		 			<td class="linkDer">描述</td>
		 			<td class="option">编辑</td>
		 			<td class="option">删除</td>
		 		</tr>
		 		<%if(linkList.size()!=0){ 
		 			for(int i=0;i<linkList.size();i++){
		 			LinkDataBean linkBean = (LinkDataBean)linkList.get(i);
		 		%>
		 		<tr>
		 			<td><div><%=linkBean.getLinkName()%></div></td>
		 			<td><div><%=linkBean.getLinkUrl()%></div></td>
		 			<td><div><%=linkBean.getLinkDescription()%></div></td>
		 			<td><div><a href="/MyBlogDemo/LinkActionServlet?method=editorLink&id=<%=linkBean.getLinkId()%>"><img border="0" src="../skin/default/image/edit.gif"/></a></div></td>
		 			<td><div><a href="../LinkActionServlet?method=delLink&id=<%=linkBean.getLinkId()%>"><img border="0" src="../skin/default/image/del.gif"/></a></div></td>
		 		</tr>
		 		<%}}%>
		 	</table>
		 	
	 	</form>
	 </div>

  	<jsp:include page="../foot.jsp"/>
  </div>
  </body>
</html>
